package com.ecpbm.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.HashSet;
import java.util.Set;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Functions implements Comparable<Functions> {
    private int id;
    private String name;
    private int parentid;
    private boolean isleaf;
    //关联属性
    private Set ais = new HashSet();
    //这里省略getter,setter方法
    //重写compareTo(Functions arg0)方法，
    //该方法用于在排序时将两个Functions对象的id进行比较
    //根据比较的结果是小于，等于或者大于而返回一个负数，零或者正数
    public int compareTo(Functions arg0) {
        return ((Integer) this.getId()).compareTo((Integer) (arg0.getId()));
    }
}